package emulator.hardware.nmos6502.commands;

import emulator.EmulatorException;
import emulator.hardware.nmos6502.Command;
import emulator.hardware.nmos6502.CommandSet;
import emulator.hardware.nmos6502.Cpu6502;
import emulator.hardware.nmos6502.Operand;
import emulator.hardware.nmos6502.operands.NoOperand;
import emulator.hardware.nmos6502.stack.StackData;

/** PHA (PusH Accumulator) */
public class PHA implements Command {

	@Override
	public void execute(Cpu6502 cpu, Operand operand) throws EmulatorException {
		cpu.pushByte((int) cpu.getAccu().getNumber(), StackData.DATA_BYTE);
	}

	@Override
	public String getName() {
		return "PHA";
	}

	@Override
	public void register(CommandSet cset) {
		cset.defineCommand(0x48, this, new NoOperand(), 3);
	}

}
